//
//  UIBarButtonItem+Extension.swift
//  WeiBo
//
//  Created by 安中 on 2020/5/2.
//  Copyright © 2020 az. All rights reserved.
//

import Foundation
import UIKit

extension UIBarButtonItem {
    convenience init(title: String, target: AnyObject?, action: Selector) {
        let btn = UIButton(type: .custom)
        btn.setTitle(title, for: .normal)
        btn.setTitleColor(UIColor.darkGray, for: .normal)
        btn.setTitleColor(UIColor.orange, for: .highlighted)
        btn.addTarget(target, action: action, for: .touchUpInside)
        
        //实例化UIBarButton
        self.init(customView: btn)
    }
}
